<template>
  <a-config-provider
    :theme="{
      token: {
        colorPrimary: '#4f65f9'
      }
    }"
    :locale="locale"
  >
    <component :is="layout">
      <router-view />
    </component>
  </a-config-provider>
</template>
<script setup lang="ts">
import { useRoute } from 'vue-router';
import zhCN from 'ant-design-vue/es/locale/zh_CN';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import DefaultLayout from '@/layouts/DefaultLayout.vue';
import PullLayout from '@/layouts/PullLayout.vue';
import { useUserStore } from '@/stores/user';

const route = useRoute();

const layout = computed(() => {
  return route.meta.layout === 'pull' ? PullLayout : DefaultLayout;
});

const locale = zhCN;
dayjs.locale('zh-cn');

// 用户store
const userStore = useUserStore();

onMounted(() => {
  userStore.fetchLoginUser();
});
</script>
<style>
@import 'tailwindcss';
</style>
